/* eslint-disable */
import React, { useState, useImperativeHandle, forwardRef } from 'react';
import { Table, Divider, Input, DatePicker, Button, Row, Col, InputNumber } from 'antd';
import moment from 'moment';
import { emptyText, formatNoFixed, debounce } from '../../../utils/commonUtil';

const { TextArea } = Input;

let RiskInformation = (props, ref) => {

  const { riskInformationData, onAdd, onCancel, useSpinFlag, basicInformationData } = props;
  const [riskList, setRiskList] = useState({ ...riskInformationData });

  useImperativeHandle(ref, () => ({
    riskList
  }));

  const onChange = (values, index, key, obj) => {
    riskList[obj][index][key] = values
    if (!riskList[obj][index].masterDataCode) riskList[obj][index].masterDataCode = basicInformationData.masterDataCode
    setRiskList({ ...riskList })
  }

  const AdministrativePunishmentRecord = [
    {
      title: '决定书文号', dataIndex: 'writtenDecision', key: 'writtenDecision',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "writtenDecision", "punishmentModelList") }}
          style={{
            color: record.writtenDecisionFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '违法行为类型', dataIndex: 'typeIllegal', key: 'typeIllegal',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "typeIllegal", "punishmentModelList") }}
          style={{
            color: record.typeIllegalFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '行政处罚内容', dataIndex: 'contentPunishment', key: 'contentPunishment',
      render: (text, record, index) => (
        <TextArea autoSize={{ minRows: 1, maxRows: 1 }} value={text} onChange={(e) => { onChange(e.target.value, index, "contentPunishment", "punishmentModelList") }}
          style={{
            color: record.contentPunishmentFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '决定机关名称', dataIndex: 'decideName', key: 'decideName',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "decideName", "punishmentModelList") }}
          style={{
            color: record.decideNameFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '处罚决定日期', dataIndex: 'datePunishment', key: 'datePunishment',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "datePunishment", "punishmentModelList") }}
          style={{
            width: "100%", color: record.datePunishmentFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '公示日期', dataIndex: 'datePublic', key: 'datePublic',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "datePublic", "punishmentModelList") }}
          style={{
            width: "100%", color: record.datePublicFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '操作', key: 'operate', width: 80,
      render: (text, record, index) => (
        <Button type="link" onClick={() => { onDelete("punishmentModelList", index) }} size="small">删除</Button>
      ),
    },
  ];

  const AbnormalOperation = [
    {
      title: '列入经营异常名录原因', dataIndex: 'includedAbnormalOperationReason', key: 'includedAbnormalOperationReason',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "includedAbnormalOperationReason", "abnormalOperationModelList") }}
          style={{
            color: record.includedAbnormalOperationReasonFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '列入日期', dataIndex: 'inDate', key: 'inDate',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "inDate", "abnormalOperationModelList") }}
          style={{
            width: "100%", color: record.inDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '列入机关名称', dataIndex: 'inDecideOrgan', key: 'inDecideOrgan',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "inDecideOrgan", "abnormalOperationModelList") }}
          style={{
            color: record.inDecideOrganFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '移出经营异常名录原因', dataIndex: 'abnormalOperationReason', key: 'abnormalOperationReason',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "abnormalOperationReason", "abnormalOperationModelList") }}
          style={{
            color: record.abnormalOperationReasonFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '移出日期', dataIndex: 'outDate', key: 'outDate',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "outDate", "abnormalOperationModelList") }}
          style={{
            width: "100%", color: record.outDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '移出机关名称', dataIndex: 'decideOrgan', key: 'decideOrgan',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "decideOrgan", "abnormalOperationModelList") }}
          style={{
            color: record.decideOrganFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '操作', key: 'operate', width: 80,
      render: (text, record, index) => (
        <Button type="link" onClick={() => { onDelete("abnormalOperationModelList", index) }} size="small">删除</Button>
      ),
    },
  ];

  const BlacklistInformation = [
    {
      title: '类型', dataIndex: 'type', key: 'type',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "type", "blackListInformationList") }}
          style={{
            color: record.typeFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '列入严重违法失信企业名单(黑名单)原因', dataIndex: 'seriousReason', key: 'seriousReason',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "seriousReason", "blackListInformationList") }}
          style={{
            color: record.seriousReasonFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '列入日期', dataIndex: 'punishmentInDate', key: 'punishmentInDate',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "punishmentInDate", "blackListInformationList") }}
          style={{
            width: "100%", color: record.punishmentInDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '作出决定机关（列入）', dataIndex: 'includedPunishmentDecideOrgan', key: 'includedPunishmentDecideOrgan',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "includedPunishmentDecideOrgan", "blackListInformationList") }}
          style={{
            color: record.includedPunishmentDecideOrganFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '移出严重违法失信企业名单(黑名单)原因', dataIndex: 'punishmentReason', key: 'punishmentReason',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "punishmentReason", "blackListInformationList") }}
          style={{
            color: record.punishmentReasonFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '移出日期', dataIndex: 'punishmentOutDate', key: 'punishmentOutDate',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "punishmentOutDate", "blackListInformationList") }}
          style={{
            width: "100%", color: record.punishmentOutDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '作出决定机关（移出）', dataIndex: 'punishmentDecideOrgan', key: 'punishmentDecideOrgan',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "punishmentDecideOrgan", "blackListInformationList") }}
          style={{
            color: record.punishmentDecideOrganFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '操作', key: 'operate', width: 80,
      render: (text, record, index) => (
        <Button type="link" onClick={() => { onDelete("blackListInformationList", index) }} size="small">删除</Button>
      ),
    },
  ];

  const PromiseEnterprise = [
    {
      title: '失信人类型', dataIndex: 'breakType', key: 'breakType',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "breakType", "promiseEnterpriseList") }}
          style={{
            color: record.breakTypeFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '被执行人姓名', dataIndex: 'subjectedPersonName', key: 'subjectedPersonName',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "subjectedPersonName", "promiseEnterpriseList") }}
          style={{
            color: record.subjectedPersonNameFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '发布时间', dataIndex: 'releaseTime', key: 'releaseTime',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "releaseTime", "promiseEnterpriseList") }}
          style={{
            width: "100%", color: record.releaseTimeFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '立案时间', dataIndex: 'caseTime', key: 'caseTime',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "caseTime", "promiseEnterpriseList") }}
          style={{
            width: "100%", color: record.caseTimeFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '身份证号码/工商注册号', dataIndex: 'cardNumber', key: 'cardNumber',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "cardNumber", "promiseEnterpriseList") }}
          style={{
            color: record.cardNumberFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '执行法院', dataIndex: 'executionCourt', key: 'executionCourt',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "executionCourt", "promiseEnterpriseList") }}
          style={{
            color: record.executionCourtFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '执行依据文号', dataIndex: 'executionDocumentNumber', key: 'executionDocumentNumber',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "executionDocumentNumber", "promiseEnterpriseList") }}
          style={{
            color: record.executionDocumentNumberFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '案号', dataIndex: 'caseNumber', key: 'caseNumber',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "caseNumber", "promiseEnterpriseList") }}
          style={{
            color: record.caseNumberFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '失信被执行人行为具体情形', dataIndex: 'specificCircumstance', key: 'specificCircumstance',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "specificCircumstance", "promiseEnterpriseList") }}
          style={{
            color: record.specificCircumstanceFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '被执行人履行情况', dataIndex: 'subjectedExecution', key: 'subjectedExecution',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "subjectedExecution", "promiseEnterpriseList") }}
          style={{
            color: record.subjectedExecutionFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '已履行（元）', dataIndex: 'performed', key: 'performed',
      render: (text, record, index) => (
        <InputNumber value={text} onChange={(e) => { onChange(e.target.value, index, "performed", "promiseEnterpriseList") }}
          style={{ width: "100%", color: record.performedFlag == 1 ? "#e64552" : "" }} formatter={value => value ? formatNoFixed(value,) : ''} />
      ),
    },
    {
      title: '未履行（元）', dataIndex: 'noPerformance', key: 'noPerformance',
      render: (text, record, index) => (
        <InputNumber value={text} onChange={(e) => { onChange(e.target.value, index, "noPerformance", "promiseEnterpriseList") }}
          style={{ width: "100%", color: record.noPerformanceFlag == 1 ? "#e64552" : "" }} formatter={value => value ? formatNoFixed(value,) : ''} />
      ),
    },
    {
      title: '操作', key: 'operate', width: 80,
      render: (text, record, index) => (
        <Button type="link" onClick={() => { onDelete("promiseEnterpriseList", index) }} size="small">删除</Button>
      ),
    },
  ];

  const ChattelMortgageInformation = [
    {
      title: '登记编号', dataIndex: 'mortgageNo', key: 'mortgageNo',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "mortgageNo", "mortgageModelList") }}
          style={{
            color: record.mortgageNoFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '登记日期', dataIndex: 'mortgageDate', key: 'mortgageDate',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "mortgageDate", "mortgageModelList") }}
          style={{
            color: record.mortgageDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '登记机关', dataIndex: 'mortgageOrg', key: 'mortgageOrg',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "mortgageOrg", "mortgageModelList") }}
          style={{
            color: record.mortgageOrgFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '被担保债权数额', dataIndex: 'amountClaim', key: 'amountClaim',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "amountClaim", "mortgageModelList") }}
          style={{
            color: record.amountClaimFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '状态', dataIndex: 'mortgageStatus', key: 'mortgageStatus',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "mortgageStatus", "mortgageModelList") }}
          style={{
            color: record.mortgageStatusFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '公示日期', dataIndex: 'mortgageDatePublic', key: 'mortgageDatePublic',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "mortgageDatePublic", "mortgageModelList") }}
          style={{
            width: "100%", color: record.mortgageDatePublicFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '操作', key: 'operate', width: 80,
      render: (text, record, index) => (
        <Button type="link" onClick={() => { onDelete("mortgageModelList", index) }} size="small">删除</Button>
      ),
    },
  ];

  const EquityPledgeInformation = [
    {
      title: '登记编号', dataIndex: 'equityNo', key: 'equityNo',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "equityNo", "equityModelList") }}
          style={{
            color: record.equityNoFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '出质人', dataIndex: 'pledge', key: 'pledge',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "pledge", "equityModelList") }}
          style={{
            color: record.pledgeFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '证照/证件号码', dataIndex: 'pledgeCertificateNo', key: 'pledgeCertificateNo',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "pledgeCertificateNo", "equityModelList") }}
          style={{
            color: record.pledgeCertificateNoFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '出质股权数额', dataIndex: 'amountEquity', key: 'amountEquity',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "amountEquity", "equityModelList") }}
          style={{
            color: record.amountEquityFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '质权人', dataIndex: 'pledgedName', key: 'pledgedName',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "pledgedName", "equityModelList") }}
          style={{
            color: record.pledgedNameFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '证照/证件号码', dataIndex: 'pledgedCertificateNo', key: 'pledgedCertificateNo',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "pledgedCertificateNo", "equityModelList") }}
          style={{
            color: record.pledgedCertificateNoFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '股权出质设立登记日期', dataIndex: 'equityDate', key: 'equityDate',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "equityDate", "equityModelList") }}
          style={{
            width: "100%", color: record.equityDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '状态', dataIndex: 'equityStatus', key: 'equityStatus',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "equityStatus", "equityModelList") }}
          style={{
            color: record.equityStatusFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '公示日期', dataIndex: 'equityPublicDate', key: 'equityPublicDate',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "equityPublicDate", "equityModelList") }}
          style={{
            width: "100%", color: record.equityPublicDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '操作', key: 'operate', width: 80,
      render: (text, record, index) => (
        <Button type="link" onClick={() => { onDelete("equityModelList", index) }} size="small">删除</Button>
      ),
    },
  ];

  const EquityFreezeInformation = [
    {
      title: '冻结金额（万元）', dataIndex: 'frozenAmount', key: 'frozenAmount',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "frozenAmount", "equityFreezeInformationList") }}
          style={{
            color: record.frozenAmountFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '冻结机关', dataIndex: 'frozenOrgan', key: 'frozenOrgan',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "frozenOrgan", "equityFreezeInformationList") }}
          style={{
            color: record.frozenOrganFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '冻结起始日期', dataIndex: 'freezingStartDate', key: 'freezingStartDate',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "freezingStartDate", "equityFreezeInformationList") }}
          style={{
            width: "100%", color: record.freezingStartDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '冻结文号', dataIndex: 'freezeTitanic', key: 'freezeTitanic',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "freezeTitanic", "equityFreezeInformationList") }}
          style={{
            color: record.freezeTitanicFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '解冻机关', dataIndex: 'thawAuthority', key: 'thawAuthority',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "thawAuthority", "equityFreezeInformationList") }}
          style={{
            color: record.thawAuthorityFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '解冻文号', dataIndex: 'thawTitanic', key: 'thawTitanic',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "thawTitanic", "equityFreezeInformationList") }}
          style={{
            color: record.thawTitanicFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '解冻日期', dataIndex: 'releaseDate', key: 'releaseDate',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "releaseDate", "equityFreezeInformationList") }}
          style={{
            width: "100%", color: record.releaseDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '解冻说明', dataIndex: 'defrostInstruction', key: 'defrostInstruction',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "defrostInstruction", "equityFreezeInformationList") }}
          style={{
            color: record.defrostInstructionFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '冻结截至日期', dataIndex: 'freezeEndDate', key: 'freezeEndDate',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "freezeEndDate", "equityFreezeInformationList") }}
          style={{
            color: record.freezeEndDateFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '操作', key: 'operate', width: 80,
      render: (text, record, index) => (
        <Button type="link" onClick={() => { onDelete("equityFreezeInformationList", index) }} size="small">删除</Button>
      ),
    },
  ];

  const EnvironmentalPenalties = [
    {
      title: '处罚日期', dataIndex: 'sortTime', key: 'sortTime',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "sortTime", "environmentPunishmentModelList") }}
          style={{
            width: "100%", color: record.sortTimeFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '决定书文号', dataIndex: 'decideNumber', key: 'decideNumber',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "decideNumber", "environmentPunishmentModelList") }}
          style={{
            color: record.decideNumberFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '处罚事由', dataIndex: 'eventBasis', key: 'eventBasis',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "eventBasis", "environmentPunishmentModelList") }}
          style={{
            color: record.eventBasisFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '处罚结果', dataIndex: 'eventResult', key: 'eventResult',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "eventResult", "environmentPunishmentModelList") }}
          style={{
            color: record.eventResultFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '处罚单位', dataIndex: 'punishmentUnit', key: 'punishmentUnit',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "punishmentUnit", "environmentPunishmentModelList") }}
          style={{
            color: record.punishmentUnitFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '操作', key: 'operate', width: 80,
      render: (text, record, index) => (
        <Button type="link" onClick={() => { onDelete("environmentPunishmentModelList", index) }} size="small">删除</Button>
      ),
    },
  ];

  const FaithlessAnnouncement = [
    {
      title: '案号', dataIndex: 'caseNo', key: 'caseNo',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "caseNo", "faithLessList") }}
          style={{
            color: record.caseNoFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '内容', dataIndex: 'body', key: 'body',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "body", "faithLessList") }}
          style={{
            color: record.bodyFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '义务', dataIndex: 'responsibility', key: 'responsibility',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "responsibility", "faithLessList") }}
          style={{
            color: record.responsibilityFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '法院名称', dataIndex: 'court', key: 'court',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "court", "faithLessList") }}
          style={{
            color: record.courtFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '立案时间', dataIndex: 'sortTime', key: 'sortTime',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "sortTime", "faithLessList") }}
          style={{
            width: "100%", color: record.sortTimeFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '发布时间', dataIndex: 'postTime', key: 'postTime',
      render: (text, record, index) => (
        <DatePicker value={text ? moment(text) : ""} onChange={(data, dateString) => { onChange(dateString, index, "postTime", "faithLessList") }}
          style={{
            width: "100%", color: record.postTimeFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '依据文号', dataIndex: 'documentNumber', key: 'documentNumber',
      render: (text, record, index) => (
        <Input value={text} onChange={(e) => { onChange(e.target.value, index, "documentNumber", "faithLessList") }}
          style={{
            color: record.documentNumberFlag == 1 ?
              "#e64552" : ""
          }} />
      ),
    },
    {
      title: '操作', key: 'operate', width: 80,
      render: (text, record, index) => (
        <Button type="link" onClick={() => { onDelete("faithLessList", index) }} size="small">删除</Button>
      ),
    },
  ];

  const addSave = (obj) => {
    riskList[obj] ? riskList[obj].push({ key: +new Date() + '' }) : riskList[obj] = [{ key: +new Date() + '' }]
    setRiskList(JSON.parse(JSON.stringify(riskList)))
  }

  const onDelete = (obj, index) => {
    let data = riskList[obj].splice(index, 1)
    setRiskList(JSON.parse(JSON.stringify(riskList)))
  }

  const debounceAddFun = debounce(onAdd, 1000)

  return (
    <div>
      <Row>
        <Col span={24} align="right">
          <Button onClick={() => onCancel()}>返回</Button>
          <Button style={{ marginLeft: '15px' }} onClick={() => { useSpinFlag(true); debounceAddFun() }}>保存</Button>
        </Col>
      </Row>
      <Divider orientation="left">行政处罚记录</Divider>
      <Table
        size="small"
        columns={AdministrativePunishmentRecord}
        dataSource={riskList.punishmentModelList}
        pagination={false}
        scroll={{ y: 500 }}
        rowKey={record => record.id ? record.id : record.key}
        style={{ marginBottom: "32px" }}
        locale={{ emptyText }}
      />
      <Row>
        <Col span={24} style={{ marginBottom: "32px" }}>
          <Button type="dashed" block onClick={() => addSave("punishmentModelList")}>新增行</Button>
        </Col>
      </Row>
      <Divider orientation="left">经营异常</Divider>
      <Table
        size="small"
        columns={AbnormalOperation}
        dataSource={riskList.abnormalOperationModelList}
        pagination={false}
        scroll={{ y: 500 }}
        rowKey={record => record.id ? record.id : record.key}
        style={{ marginBottom: "32px" }}
        locale={{ emptyText }}
      />
      <Row>
        <Col span={24} style={{ marginBottom: "32px" }}>
          <Button type="dashed" block onClick={() => addSave("abnormalOperationModelList")}>新增行</Button>
        </Col>
      </Row>
      <Divider orientation="left">列入严重违法企业名单信息</Divider>
      <Table
        size="small"
        columns={BlacklistInformation}
        dataSource={riskList.blackListInformationList}
        pagination={false}
        scroll={{ y: 500 }}
        rowKey={record => record.id ? record.id : record.key}
        style={{ marginBottom: "32px" }}
        locale={{ emptyText }}
      />
      <Row>
        <Col span={24} style={{ marginBottom: "32px" }}>
          <Button type="dashed" block onClick={() => addSave("blackListInformationList")}>新增行</Button>
        </Col>
      </Row>
      <Divider orientation="left">失信企业</Divider>
      <Table
        size="small"
        columns={PromiseEnterprise}
        dataSource={riskList.promiseEnterpriseList}
        pagination={false}
        scroll={{ y: 500 }}
        rowKey={record => record.id ? record.id : record.key}
        style={{ marginBottom: "32px" }}
        locale={{ emptyText }}
      />
      <Row>
        <Col span={24} style={{ marginBottom: "32px" }}>
          <Button type="dashed" block onClick={() => addSave("promiseEnterpriseList")}>新增行</Button>
        </Col>
      </Row>
      <Divider orientation="left">动产抵押登记信息</Divider>
      <Table
        size="small"
        columns={ChattelMortgageInformation}
        dataSource={riskList.mortgageModelList}
        pagination={false}
        scroll={{ y: 500 }}
        rowKey={record => record.id ? record.id : record.key}
        style={{ marginBottom: "32px" }}
        locale={{ emptyText }}
      />
      <Row>
        <Col span={24} style={{ marginBottom: "32px" }}>
          <Button type="dashed" block onClick={() => addSave("mortgageModelList")}>新增行</Button>
        </Col>
      </Row>
      <Divider orientation="left">股权出质登记信息</Divider>
      <Table
        size="small"
        columns={EquityPledgeInformation}
        dataSource={riskList.equityModelList}
        pagination={false}
        scroll={{ y: 500 }}
        rowKey={record => record.id ? record.id : record.key}
        style={{ marginBottom: "32px" }}
        locale={{ emptyText }}
      />
      <Row>
        <Col span={24} style={{ marginBottom: "32px" }}>
          <Button type="dashed" block onClick={() => addSave("equityModelList")}>新增行</Button>
        </Col>
      </Row>
      <Divider orientation="left">股权冻结信息</Divider>
      <Table
        size="small"
        columns={EquityFreezeInformation}
        dataSource={riskList.equityFreezeInformationList}
        pagination={false}
        scroll={{ y: 500 }}
        rowKey={record => record.id ? record.id : record.key}
        style={{ marginBottom: "32px" }}
        locale={{ emptyText }}
      />
      <Row>
        <Col span={24} style={{ marginBottom: "32px" }}>
          <Button type="dashed" block onClick={() => addSave("equityFreezeInformationList")}>新增行</Button>
        </Col>
      </Row>
      <Divider orientation="left">环保处罚</Divider>
      <Table
        size="small"
        columns={EnvironmentalPenalties}
        dataSource={riskList.environmentPunishmentModelList}
        pagination={false}
        scroll={{ y: 500 }}
        rowKey={record => record.id ? record.id : record.key}
        style={{ marginBottom: "32px" }}
        locale={{ emptyText }}
      />
      <Row>
        <Col span={24} style={{ marginBottom: "32px" }}>
          <Button type="dashed" block onClick={() => addSave("environmentPunishmentModelList")}>新增行</Button>
        </Col>
      </Row>
      <Divider orientation="left">失信公告</Divider>
      <Table
        size="small"
        columns={FaithlessAnnouncement}
        dataSource={riskList.faithLessList}
        pagination={false}
        scroll={{ y: 500 }}
        rowKey={record => record.id ? record.id : record.key}
        locale={{ emptyText }}
        style={{ marginBottom: "32px" }}
      />
      <Row>
        <Col span={24} style={{ marginBottom: "200px" }}>
          <Button type="dashed" block onClick={() => addSave("faithLessList")}>新增行</Button>
        </Col>
      </Row>
    </div>
  );
}

RiskInformation = forwardRef(RiskInformation)

export default RiskInformation;
